home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / vla / modplay.lzh / MODMAIN.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-03-18  |  2.7 KB  |  124 lines

  1.     DOSSEG
  2.     .286
  3.     .MODEL SMALL
  4.     .STACK  200h
  5.     .CODE
  6.     ASSUME  cs:@code, ds:@code, es:@code
  7.  
  8. ;=======- DMA GLOBALS
  9.  
  10.     GLOBAL  Status:WORD
  11.     GLOBAL  IntNumber:BYTE, BaseAddress:WORD
  12.  
  13. ;=======-   MOD SUB GLOBALS
  14.  
  15.     GLOBAL  StartPlaying:NEAR, StopPlaying:NEAR
  16.     GLOBAL  Mute:NEAR, UnMute:NEAR
  17.     GLOBAL  UpDate:NEAR
  18.  
  19.     GLOBAL  ModSeg:WORD, ComputerSpeed:BYTE ;range 1-6?
  20.     GLOBAL  ModName:BYTE, MasterVolume:byte
  21.  
  22. ;=====- Command line capture
  23. ;FILE: MCLSUB.ASM
  24. ;upon entry: 
  25. ;
  26. ;*      ES= PSP SEG 
  27. ;*      DS:DX = pointer to filename area
  28. ;*      DS:BX = pointer to 5 byte 0 terminating Extension to add
  29. ;
  30. ;RETURN:    AX= length of command line
  31.  
  32. GLOBAL  GetCommandLine:NEAR
  33.  
  34. ;=======- Necessary DATA
  35.  
  36.     ModName     db  0,130 dup (0)   ;filename goes here
  37.     Extension   db  ".MOD",0,"$"
  38.     ModSeg      dw  0
  39.     DspSeg      dw  0
  40.  
  41.     Credits db  10
  42.             db  "                       AI MOD player by Draeden of VLA! ",13,10
  43.             db  "                      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀",13,10
  44.             db  "                        Gauranteed to play your MOD in  ",13,10
  45.             db  "                        a way that was never intended!  ",13,10,10
  46.             db  "                          -=Press any key to exit!=-    ",13,10
  47.             db  "$"
  48.  
  49.     ErrorMsg  db "Error loading file.$"
  50.  
  51. ;=======- START MAIN
  52.  
  53. Start:
  54.     mov     ax,es
  55.     mov     cs:[DspSeg],ax
  56.     mov     ax,cs
  57.     mov     ds,ax
  58.     mov     bx,ss
  59.     add     bx,20h
  60.     mov     [ModSeg],bx      ;MUST be last one - stacks on top of it
  61.     mov     [ComputerSpeed],6   ;range 0-6
  62.     mov     [IntNumber],7       ; the IRQ number
  63.     mov     [BaseAddress],220h  ;base I/O address- DMA channel is ONE
  64.     mov     [MasterVolume],255  ;max volume
  65.  
  66.     mov     dx,offset ModName
  67.     mov     bx,offset Extension
  68.     call    GetCommandLine
  69.     
  70.     or      ax,ax
  71.     je      ExitError
  72.  
  73.     mov     ax,0003h    ;reset 80x25x16 (clear screen)
  74.     int     10h
  75.  
  76.     mov     ax,cs
  77.     mov     ds,ax
  78.     mov     dx,offset Credits
  79.     mov     ah,9
  80.     int     21h
  81.  
  82.     mov     ah,2
  83.     mov     dx,2000h
  84.     mov     bx,0
  85.     int     10h         ;move cursor off screen
  86.  
  87.     call    StartPlaying    ;this loads and begins playing the MOD
  88.     cmp     ax,-1           ;returns ax=-1 if something went wrong
  89.     je      ExitError
  90. MainLoop:
  91.     call    Update          ;must be called- updates the mixed data
  92.  
  93.     mov     ah,1            ;check for keypress
  94.     int     16h
  95.     jz      MainLoop
  96.  
  97.     mov     ah,0            ;get keypress
  98.     int     16h
  99.  
  100. ExitAllDone:
  101.     call    StopPlaying     ;turns off speaker, resets all interrupts changed
  102.     
  103.     mov     ah,2
  104.     mov     dx,1000h
  105.     mov     bx,0
  106.     int     10h         ;move cursor back on screen
  107.  
  108. ByeBye:
  109.     mov     ax,4c00h
  110.     int     21h
  111.  
  112. ExitError:
  113.     push    cs
  114.     pop     ds
  115.     mov     ah,9
  116.     mov     dx,offset ErrorMsg
  117.     int     21h
  118.     jmp     ByeBye
  119.  
  120. END Start
  121.  
  122.  
  123.  
  124.